<!--
 * @Author: your name
 * @Date: 2021-09-06 17:13:11
 * @LastEditTime: 2021-09-18 14:41:36
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \EJ-WEBUI\src\views\journal\index.vue
-->
<template>
  <div class="production">
    <div class="btns">
    </div>
    <div class="content">
      <!-- 表格 -->
      <el-table
        :data="resData.list"
        style="width: 100%"
        size="small"
      >
        <el-table-column width="200px" type="index" label="序号"></el-table-column>
        <el-table-column label="访问人真实姓名" prop="realname"></el-table-column>
        <el-table-column label="访问方式" prop="method"></el-table-column>
        <el-table-column label="访问路径" prop="content"></el-table-column>
        <el-table-column
          v-if="resData.list && resData.list != ''"
          label="访问时间"
          prop=""
        >
          {{ resData.list[0].logTime | fmtDate }}
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <el-pagination
        background
        align="center"
        layout="prev, pager, next, sizes"
        :total="resData.total"
        :page-size="params.pageSize"
        :current-page="params.page"
        @current-change="pageChangeHandler"
        :page-sizes="[5, 10, 15]"
        @size-change="pageSizeChangeHandler"
      >
      </el-pagination>
    </div>
  </div>
</template>
<script>
import requset from "@/utils/request";
import _ from "lodash";
export default {
  data() {
    return {
      params: {
        page: 1,
        pageSize: 5,
      },
      resData: {},
      categories: [],
      formLabelWidth: "80px",
    };
  },
  methods: {
    // 选中行的绑定事件

    // 监听选中项的改变
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    // 分页查询产品表格
    async pageQueryComments() {
      // 过滤数据将空字符串删除
      for (let key in this.params) {
        if (this.params[key] == "") {
          delete this.params[key];
        }
      }

      let res = await requset.get("/baseLog/pageQuery", {
        params: this.params,
      });
      this.resData = res.data;
      // console.log(this.params);
      //  console.log(this.resData.list);
    },
    // page改变事件
    pageChangeHandler(page) {
      this.params.page = page;
      this.pageQueryComments();
    },
    // pageSize改变事件
    pageSizeChangeHandler(pageSize) {
      this.params.pageSize = pageSize;
      this.pageQueryComments();
    },
   
  },
  created() {
    this.pageQueryComments(); // 分页查询产品
  },
};
</script>
<style>
.el-pagination{
  margin: 30px;
}
</style>